import React, {Component, PropTypes} from 'react';

import "./styles/Avatar.less";

class Avatar extends Component {
	getStyle() {
		return Object.assign(this.props.style || {}, {
			width: this.props.size, height: this.props.size,
			backgroundImage: `url('${this.props.src}@${this.props.size}h_${this.props.size}w_1c_1e_l0.jpg')`
		})
	}
	render() {
		let {className, style, ...props} = this.props;
		return (
			<span className={`Avatar ${className}`} {...props} style={this.getStyle()}></span>
		)
	}
}

export default Avatar;

Avatar.propTypes = {
	src: PropTypes.string,
	size: PropTypes.number
};

Avatar.defaultProps = {
	size: 32
};